package com.sumi.erp.service.impl;

import java.util.List;
import com.sumi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sumi.erp.mapper.OrderPurchaseMapper;
import com.sumi.erp.domain.OrderPurchase;
import com.sumi.erp.service.IOrderPurchaseService;

/**
 * 采购单主Service业务层处理
 * 
 * @author fgf67@163.com
 * @date 2024-06-27
 */
@Service
public class OrderPurchaseServiceImpl implements IOrderPurchaseService 
{
    @Autowired
    private OrderPurchaseMapper orderPurchaseMapper;

    /**
     * 查询采购单主
     * 
     * @param id 采购单主主键
     * @return 采购单主
     */
    @Override
    public OrderPurchase selectOrderPurchaseById(Long id)
    {
        return orderPurchaseMapper.selectOrderPurchaseById(id);
    }

    /**
     * 查询采购单主列表
     * 
     * @param orderPurchase 采购单主
     * @return 采购单主
     */
    @Override
    public List<OrderPurchase> selectOrderPurchaseList(OrderPurchase orderPurchase)
    {
        return orderPurchaseMapper.selectOrderPurchaseList(orderPurchase);
    }

    /**
     * 新增采购单主
     * 
     * @param orderPurchase 采购单主
     * @return 结果
     */
    @Override
    public int insertOrderPurchase(OrderPurchase orderPurchase)
    {
        orderPurchase.setCreateTime(DateUtils.getNowDate());
        return orderPurchaseMapper.insertOrderPurchase(orderPurchase);
    }

    /**
     * 修改采购单主
     * 
     * @param orderPurchase 采购单主
     * @return 结果
     */
    @Override
    public int updateOrderPurchase(OrderPurchase orderPurchase)
    {
        return orderPurchaseMapper.updateOrderPurchase(orderPurchase);
    }

    /**
     * 批量删除采购单主
     * 
     * @param ids 需要删除的采购单主主键
     * @return 结果
     */
    @Override
    public int deleteOrderPurchaseByIds(Long[] ids)
    {
        return orderPurchaseMapper.deleteOrderPurchaseByIds(ids);
    }

    /**
     * 删除采购单主信息
     * 
     * @param id 采购单主主键
     * @return 结果
     */
    @Override
    public int deleteOrderPurchaseById(Long id)
    {
        return orderPurchaseMapper.deleteOrderPurchaseById(id);
    }
}
